home *** CD-ROM | disk | FTP | other *** search
- unit ServData;
-
- { This Datamodule is the CoClass for the IEmpServer interface. It was
- created using the File | New | ActiveX | Remote Data Module menu option }
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- ComServ, ComObj, VCLCom, StdVcl, ServIntf, Provider, BdeProv, Db,
- DBTables;
-
- type
-
- TEmpServer = class(TDataModule, IEmpServer)
- EmpQuery: TQuery;
- procedure EmpQueryAfterOpen(DataSet: TDataSet);
- procedure EmpServerCreate(Sender: TObject);
- procedure EmpServerDestroy(Sender: TObject);
- protected
- { This is the property reader for IEmpServer.Employees. See ServIntf.PAS
- It was created using File | New Interface Procedure and typing:
- "property Employees: IProvider;" }
- function Get_Employees: IProvider; safecall;
- end;
-
- var
- EmpServer: TEmpServer;
-
- implementation
-
- {$R *.DFM}
-
- uses ServMain;
-
- function TEmpServer.Get_Employees: IProvider;
- begin
- { This is the important code. Here we return the IProvider interface from
- our Query component }
- Result := EmpQuery.Provider;
- end;
-
- { ========================================================================
- This rest of this code is just demonstrates how you might monitor client
- activity from the server. None of this is needed to use client datasets. }
-
- procedure TEmpServer.EmpQueryAfterOpen(DataSet: TDataSet);
- begin
- { Update the query counter }
- MainForm.IncQueryCount;
- end;
-
- procedure TEmpServer.EmpServerCreate(Sender: TObject);
- begin
- { Update the client counter }
- MainForm.UpdateClientCount(1);
- end;
-
- procedure TEmpServer.EmpServerDestroy(Sender: TObject);
- begin
- { Update the client counter }
- MainForm.UpdateClientCount(-1);
- end;
-
- initialization
- { This creates the class factory for us. This code is generated automatically }
- TComponentFactory.Create(ComServer, TEmpServer, Class_EmpServer,
- ciMultiInstance);
- end.
-